package com.opensource.component.clickhorse.controller;

import com.opensource.component.clickhorse.mapper.PersonMapper;
import com.opensource.component.clickhorse.model.PersonDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ZonLen since on 2021/4/5 上午10:25
 */
@RestController
@RequestMapping("/person")
public class PersonController {
  @Autowired
  private PersonMapper personMapper;

  @PostMapping("/savePerson")
  public void savePerson(@RequestBody PersonDO person) {
    personMapper.savePerson(person);
  }

  @GetMapping("/personDetail/{id}")
  public PersonDO personDetail(@PathVariable String id) {
    return personMapper.personDetail(id);
  }

  @PostMapping("/editPerson")
  public void editPerson(@RequestBody PersonDO person) {
    personMapper.editPerson(person);
  }

  @PostMapping("/delPerson/{id}")
  public void delPerson(@PathVariable String id) {
    personMapper.delPerson(id);
  }

}
